package demo4many_Interface;

interface A{
    void testA();
}

interface B{
    void testB();
}

//接口之间的继承
//相当于把多个接口合并在一起
interface C extends A,B{
    void testC();
}

class D implements C{
    @Override
    public void testA() {

    }

    @Override
    public void testB() {

    }

    @Override
    public void testC() {

    }
}


//继承表达的含义是is-a语义，而接口表达的含义是具有×××特性
public class Test {

    public static void main(String[] args) {
        Dog dog1=new Dog("hahah",12);
        Dog dog2=new Dog("hahah",12);
        System.out.println(dog1==dog2);
        System.out.println(dog1.equals(dog2));
        System.out.println("=================");
        System.out.println(dog1.hashCode());
        System.out.println(dog2.hashCode());
    }

    public static void func1(Animal animal){
        animal.eat();
    }

    public static void running(IRunning iRunning){
        iRunning.run();
    }

    public static void swimming(ISwimming iSwimming){
        iSwimming.swim();
    }

    public static void fly(IFly iFly){
        iFly.fly();
    }

    public static void main4(String[] args) {
        fly(new Duck("2232",3));
    }
    public static void main3(String[] args) {
        swimming(new Fish("aaa",1));
        swimming(new Dog("dsdsds",2));
        swimming(new Duck("rr",58));
    }
    public static void main2(String[] args) {

        running(new Dog("hhh",1));
        running(new Duck("www",20));
//        running(new Fish("1212",2));
    }

    public static void main1(String[] args) {
        func1(new Dog("旺财",14));
        func1(new Duck("唐老鸭",62));
        func1(new Fish("金鱼",24));
    }
}
